<?php echo $this->fetch('header.html'); ?>
<script type="text/javascript" src="mobile/js/mobile_notice.js"></script>
<script type="text/javascript">
function register() {
    var ret_url = $("#ret_url").attr("value");
    var password = $("#password").val();
    var user_name = $("#user_name").val();
    var email = $("#email").val();
    var password_confirm = $("#password_confirm").val();
    var captcha = $("#captcha1").val();
    var agree = $('#clause').prop('checked') ? 1 : 0; 
					
	$.ajax({
		url: REAL_SITE_URL + '/index.php?app=member&act=register',
		data: {
			'user_name': user_name,
			'password': password,
			'password_confirm': password_confirm,
			'email': email,
			'agree': agree,
			'captcha': captcha
		},
		type: 'post',
		dataType: 'json',
 		async: false,
		success: function(data) {
			if(data.done){
				errormsg(data.msg);
				setTimeout(function() {
					window.location.href = ret_url ? unescape(ret_url) : REAL_SITE_URL + "/index.php";
 				}, 1500);
			} else {
 				errormsg(data.msg);
			}
		}
	})
}
</script>

<div id="main">

	<div id="page-auth" class="page-register page-body">

        <dl class="form pb20">

				<dd><input type="text" id="user_name" name="user_name" class="input" placeholder=" 用户名必须在3-15个字符之间"/></dd>

                <dd><input type="password" id="password" name="password" class="input" placeholder=" 密码长度应在6-20个字符之间"/></dd>

                <dd><input type="password" name="password_confirm" id="password_confirm" class="input" placeholder=" 请再次输入密码"/></dd>

				<dd><input type="text" name="email" id="email" class="input" placeholder=" 请输入电子邮箱"/></dd>
				<?php if ($this->_var['captcha']): ?>

                <dd class="captcha-box">

                    <input type="text" name="captcha" class="input captcha" id="captcha1" placeholder=" 请输入验证码" />

                    <img id="captcha" src="<?php echo $this->_var['real_site_url']; ?>/index.php?app=captcha&amp;<?php echo $this->_var['random_number']; ?>" onclick="javascript:change_captcha($('#captcha'));" /><br />

                </dd>

                <?php endif; ?>

                <dd class="block mb10 clearfix read-licence">

					<input id="clause" type="checkbox"  name="agree" value="1" checked="checked"  /> 

                	<label for="clause" style="color:#333;" >

                		我已阅读并同意 <a href="<?php echo url('app=article&act=system&code=eula'); ?>" target="_blank">用户服务协议</a>

                	</label>

                </dd>

				<input type="button" onclick="register();" class="enter yahei"  value="注册" />

                <input type="hidden" name="ret_url" value="<?php echo $this->_var['ret_url']; ?>" />

                <p class="mt20"><a href="<?php echo url('app=member&act=login'); ?>">已经拥有账号</a></p>

		</dl>

	</div>

</div>

<?php echo $this->fetch('footer.html'); ?>

